{% extends "h:templates/layouts/group.html.jinja2" %}

{% set page_title = group.name %}

{% block page_content %}
  <div class="join-group-form">
    <h1 class="form-header">Group invitation</h1>

    <p class="join-group-form__label">
      You've been invited to join the annotation group:
    </p>

    <div class="join-group-form__container">
      <div class="join-group-form__group-name">
        {{ group.name }}
      </div>
      <div class="join-group-form__group-description">
        {% if group.description %}{{ group.description }}{% endif %}
      </div>
      {% if request.authenticated_userid %}
        <form method="POST">
          <button class="btn primary-action-btn group-form__submit-btn" name="group_join" type="submit">
            Join {{ group.name }}
          </button>
        </form>
      {% else %}
        <form method="GET" action="{{ request.route_url('login') }}">
          <input type="hidden" name="next" value="{{ request.path }}">
          <button class="btn primary-action-btn group-form__submit-btn" type="submit">
            Log in to join {{ group.name }}
          </button>
        </form>
      {% endif %}
    </div>
  </div>

  <footer class="form-footer">
    What is Hypothesis? <a class="link--footer" href="https://hypothes.is/about">Learn more</a>
  </footer>
{% endblock page_content %}
